//properties settings for text input
fmdmeta_prop.control.input = {
		//group for element list - basic/composite/custom/extended
		"group" : "basic",
		//control category
		"controlcategory" : "datacontrol",
		//i18n type name
		"i18ntype" : fmd_i18n_el_input,
		//icon in element list, located in images/designer/modules/
		"icon" : "elem_input.png",
		//html code for dragging
		"innerhtml_dragging" : '<label class="title">'+fmd_i18n_untitled+'</label><input class="large" type="text" readonly="readonly"/>',
		//html code after dropped
		"innerhtml_dropped" : '<label class="title">'+fmd_i18n_untitled+'</label><input class="large" type="text" readonly="readonly"/>',
		//properties
		"includes-properties" : {
			"common" : fmdmeta_prop.common.all.properties,
			"controlcommon" : fmdmeta_prop.common.datacontrol.properties
		},
		"properties" : {
			"i18ntype" : {
		    	"name" : fmd_i18n_prop_selectiontype,
		    	"img" : "selection.png",
		    	"cellType" : "ro",
		    	"value" : {"default":fmd_i18n_el_input},
		    	"displayOnly" : true,
		    	"afterProperty" : "id"
		    },
		    "databinding" : {
		    	"name" : fmd_i18n_prop_binding,
		    	"img" : "databinding.png",
		    	"cellType" : {
					"type" : "coro",
					"options":"fmdmeta_prop.model_binding_list" //initialized later, so use a reference here, call eval when use
			    },
			    "value" : {"default":""},
		    	"validator" : "NotEmpty"
		    },
		    /*"processbinding" : {
		    	"name" : fmd_i18n_prop_pbinding,
		    	"img" : "processbinding.png",
		    	"cellType" : "processbinding"
		    },*/
		    "validation-value" : {
		    	"name" : fmd_i18n_prop_valuevalidation,
		    	"img" : "validation.png",
			    "cellType" : "ace_validation",
			    "arguments" : {
					"v" : fmd_i18n_modules.input.value
				},
				"params" : {
					"require" : "databinding",
					"inputindex" : 0	//input index for validation in this component, starts from 0
				},
			    "value" : {"default":""}
		    },
		    /*"contentType" : {
		    	"name" : fmd_i18n_prop_contenttype,
		    	"cellType" : {
					"type" : "coro",
					"options":[["text",fmd_i18n_prop_normaltext],
					         ["integer",fmd_i18n_prop_integer],
					         ["money",fmd_i18n_prop_money],
					         ["email",fmd_i18n_prop_email],
                             ["phone",fmd_i18n_prop_phone],
                             ["mobile-cn",fmd_i18n_prop_mobilecn]
					]
			    },
			    "conditional-sub" : {
					"integer" : {
						"contentType-integer" : {
							"name" : fmd_i18n_prop_allownegtive,
							"cellType" : "ch",
							"value" : {"default":"0"}
						}
					},
					"money" : {
						"contentType-money" : {
							"name" : fmd_i18n_prop_allownegtive,
							"cellType" : "ch",
							"value" : {"default":"0"}
						}
					}
				},
		    	"value" : {"default":"text"}
		    },*/
		    "maxlength" : {
		    	"name" : fmd_i18n_prop_maxlength,
		    	"cellType" : "ed",
		    	"value" : {"default":"10"},
		    	"validator" : "ValidInteger",
		    	"tooltip" : fmd_i18n_modules.input.tip_maxlength
		    },
		    "autocomplete" : {
		    	"name" : fmd_i18n_modules.input.autocomplete,
		    	"cellType" : "ch",
		    	"value" : {"default":"0"},
		    	"conditional-sub" : {
				    "1" : {
				    	"autocomplete-allowcustomvalue" : {
			    			"name" : fmd_i18n_modules.input.allowcustomvalue,
			    			"cellType" : "ch",
			    			"value" : {"default":"0"}
			    		},
				    	"autocomplete-dataprovider" : {
					    	"name" : fmd_i18n_modules.input.autocompletedataprovider,
					    	"img" : "dataprovider.png",
						    "cellType" : {
								"type" : "coro",
								"options":[["acd-dataprovider-restsrv", fmd_i18n_prop_restsrv],
								           ["acd-dataprovider-dict",fmd_i18n_prop_dict]]
						    },
						    "conditional-sub" : {
							    "acd-dataprovider-restsrv" : {
							    	"acd-dataprovider-restsrv" : {
							    		"name" : fmd_i18n_prop_restsrv,
										"cellType" : {
			    	    					"type" : "btnex",
			    	    					"config" : {
			    	    						"displayValue" : "displayValue",
			    	    	    				"onclick" : fmdmeta_prop.func.selectService
			    	    	    			}
			    	    				},
										"validator" : "NotEmptyObject"
									}
							    },
							    "acd-dataprovider-dict" : {
									"acd-dataprovider-dict" : {
										"name" : fmd_i18n_prop_dict,
										"cellType" : {
			    	    					"type" : "btnex",
			    	    					"config" : {
			    	    						"displayValue" : "displayValue",
			    	    	    				"onclick" : fmdmeta_prop.func.selectDict
			    	    	    			}
			    	    				},
										"validator" : "NotEmptyObject"
									}
							    }
							},
							"value" : {"default":"acd-dataprovider-restsrv"}
					    }
				    }
		    	}
		    }
		},
		"includes-events" : {
			"common" : fmdmeta_prop.common.all.events,
			"controlcommon" : fmdmeta_prop.common.datacontrol.events
		},
		"events" : {
			
		},
		"onApply" : function() {
			var obj = designer.getSelected();
			var vals = fmdc.version.formdata.propconf[obj.attr("id")];
			//alert('input onApply fmdc.version.formdata.propconf[$obj.attr("id")]=\n'+JSON.stringify(vals));
			if (vals["labelPosition"]=='left') {
				obj.html('<span style="width:100%;display:inline;"><label style="width:40%;float:left;" class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label><input style="width:60%" class="large" type="text" name="input" readonly="readonly"/></span>');
			} else if (vals["labelPosition"]=='right') {
				obj.html('<span style="width:100%;display:inline"><input style="width:60%" class="large" type="text" name="input" readonly="readonly"/><label style="width:40%;float:right;" class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label></span>');
			} else if (vals["labelPosition"]=='bottom') {
				obj.html('<input class="large" type="text" name="input" readonly="readonly"/><label class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label>');
			} else {//default is top
				obj.html('<label class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label><input class="large" type="text" name="input" readonly="readonly"/>');
			}
			obj.find('label')//.html(vals["i18nname-"+fmdmeta_prop.lang])
				.css("display", (vals["hideLabel"]=='1')?"none":"block");
			obj.find('input').attr("disabled", vals["disabled"]=='1');
			// && obj.attr('maxlength', vals["maxlength"]).css("display", "inline-block");
		},
		"propDhxGridEvents" : {
			"onEditCell" : function(stage,rId,cId,nv,ov) {
				return true;
			},
			"onCellChanged" : function(rId,cId,nv) {
				if (nv && cId==fmdmeta_prop.gridconf.idx.value) {
					if (rId=='autocomplete') {
						//fmdpf_showConditionalSub(rId, nv, fmdmeta_prop.control.input.properties[rId]);
						fmdmeta_prop.control.input["propDhxGridEvents"].onCellChanged("autocomplete-dataprovider",
								fmdmeta_prop.gridconf.idx.value,
								this.cells("autocomplete-dataprovider", fmdmeta_prop.gridconf.idx.value).getValue());
					} else if (rId=="autocomplete-dataprovider") {
						//fmdpf_showConditionalSub(rId, nv, fmdmeta_prop.control.input.properties.autocomplete["conditional-sub"]["1"][rId]);
					} else if (rId=='databinding') {
						var vals = nv.split(".");
						if (vals && vals.length==2) {
							if (fmdc.models[vals[0]] && fmdc.models[vals[0]].attrs[vals[1]]) {
								if (this.doesRowExist("i18nname-zh")) {
									var zh = this.cells("i18nname-zh", cId).getValue();
									if (!zh || zh==fmd_i18n_untitled) this.cells("i18nname-zh", cId).setValue(fmdc.models[vals[0]].attrs[vals[1]].desc_zh);
								}
								if (this.doesRowExist("i18nname-en")) {
									var en = this.cells("i18nname-en", cId).getValue();
									if (!en || en=='Untitled') this.cells("i18nname-en", cId).setValue(fmdc.models[vals[0]].attrs[vals[1]].desc_en);
								}
							} else {
								this.cells(rId,cId).setValue('');
							}
						}
					}
				}
			}
		},
		"postLoaded" : function(controlType){
			if (fmdmeta_prop.elemAttachEnabled) {
				fmdmeta_prop.control[controlType].properties["attachment"] = {
			    	"name" : fmd_i18n_prop_upattach,
			    	"cellType" : "ch",
			    	"tooltip" : fmd_i18n_prop_tip_upattach,
			    	"value" : {"default":"0"},
			    	"conditional-sub" : {
			    		"1" : {
			    			"attachmentTag" : {
			    				"name" : fmd_i18n_prop_upattachTag,
						    	"cellType" : "ed",
						    	"tooltip" : fmd_i18n_prop_tip_upattachTag,
						    	"value" : {"default":""},
						    	"validatorFunc" : function() {
						    		
						    	}
			    			},
			    			"attachmentEditable" : {
			    				"name" : fmd_i18n_prop_upattachEditable,
						    	"cellType" : "ch",
						    	"value" : {"default":"0"}
			    			}
			    		}
			    	}
			    }
			}
		}
	};
